<?php
/**
 * The template for displaying posts in the Gallery Post Format on index and archive pages
 *
 * Learn more: http://codex.wordpress.org/Post_Formats
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>
<!-- Libs CSS -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/bootstrap.css">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/bootstrap-responsive.css">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/theme-blog.css">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/fonts/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/vendor/flexslider/flexslider.css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/vendor/fancybox/jquery.fancybox.css" media="screen" />

<!-- Theme CSS -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/theme.css">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/theme-elements.css">

<!-- Current Page Styles -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/theme-blog.css" media="screen" />

<!-- Custom CSS -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/custom.css">

<!-- Skin -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/skins/blue.css">

<!-- Responsive CSS -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/bootstrap-responsive.css" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/theme-responsive.css" />

<!-- Head Libs -->
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/modernizr.js"></script>

<div class="row">
    <div class="span9">
        <div class="blog-posts single-post">

            <article class="post post-large-image blog-single-post">
                <?php
                $date_format_mode = get_the_date("F j");
                $date_split = explode(" ", $date_format_mode);
                ?>
                <div class="post-date">
                    <span class="day"><?php echo $date_split[1]; ?></span>
                    <span class="month"><?php echo $date_split[0]; ?></span>
                </div>

                <div class="post-content">

                    <h2 style="color:#0088CC"><?php the_title(); ?></h2>

                    <div class="post-meta">
                        <span><i class="icon-user"></i> By <a href="#"><?php the_author(); ?></a> </span>

                        <span><i class="icon-comments"></i> <a href="#"><?php comments_number('no responses', 'one response', '% responses'); ?></a></span>
                    </div>

                    <p><?php the_content(); ?></p>


                    <div class="post-block post-share">
                        <h3><i class="icon-share"></i>Share this post</h3>

                        <!-- AddThis Button BEGIN -->
                        <div class="addthis_toolbox addthis_default_style ">
                            <a fb:like:layout="button_count" class="addthis_button_facebook_like"></a>
                            <a class="addthis_button_tweet"></a>
                            <a class="addthis_button_pinterest_pinit"></a>
                            <a class="addthis_counter addthis_pill_style"></a>
                        </div>
                        <script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-50faf75173aadc53" type="text/javascript"></script>
                        <!-- AddThis Button END -->

                    </div>

                    <div class="post-block post-comments clearfix">
<?php comments_template('', true); ?>
                    </div>


                </div>
            </article>

        </div>
    </div>

    <div class="span3">
        <?php
        $categories = get_the_category();
        if ($categories[0]->name == "Blog")
            $parentcat = $categories[0]->cat_ID;
        if ($categories[1]->name == "Blog")
            $parentcat = $categories[0]->cat_ID;
        if ($categories[2]->name == "Blog")
            $parentcat = $categories[0]->cat_ID;
//print_r($categories);
//$cat_object = $wp_query->get_queried_object();
///$parentcat = ($cat_object->category_parent) ? $cat_object->category_parent : $cat;
//echo "<script>alert('".$parentcat."')</script>";
        $args = array(
            'show_option_all' => '',
            'orderby' => 'name',
            'order' => 'ASC',
            'style' => 'list',
            'show_count' => 0,
            'hide_empty' => 1,
            'use_desc_for_title' => 1,
            'child_of' => $parentcat,
            'feed' => '',
            'feed_type' => '',
            'feed_image' => '',
            'exclude' => '',
            'exclude_tree' => '',
            'include' => '',
            'hierarchical' => 1,
            'title_li' => __(''),
            'show_option_none' => __('No categories'),
            'number' => null,
            'echo' => 1,
            'depth' => 0,
            'current_category' => 0,
            'pad_counts' => 0,
            'taxonomy' => 'category',
            'walker' => null
        );
        ?>
        <aside class="sidebar">

            <form class="form-search" id="searchForm" action="<?php echo esc_url(home_url('/')); ?>" method="get">
                <div class="input-append">
                    <input type="text" class="span2 search-query" name="s" id="s" placeholder="Search for <?php echo ($cat_object->name); ?>...">
                    <button class="btn btn-primary" type="submit"><i class="icon-search"></i></button>
                </div>
            </form>

            <hr>
            <h4>Categories</h4>
            <ul class="nav nav-list primary pull-bottom">
<?php wp_list_categories($args); ?>
            </ul>
            <hr>
<?php get_sidebar("blog"); ?>

        </aside>
    </div>
</div>

<!-- Libs -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/jquery.js"><\/script>')</script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/jquery.easing.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/jquery.cookie.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/bootstrap.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/selectnav.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/twitterjs/twitter.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/flexslider/jquery.flexslider.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/jflickrfeed/jflickrfeed.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/fancybox/jquery.fancybox.js"></script>
<script src="<?php bloginfo('stylesheet_directory'); ?>/vendor/jquery.validate.js"></script>

<script src="<?php bloginfo('stylesheet_directory'); ?>/js/plugins.js"></script>

<!-- Page Scripts -->

<!-- Theme Initializer -->
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/theme.js"></script>

<!-- Custom JS -->
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/custom.js"></script>